home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / programming / basic / onlinetimer / onlinetimer.bas next >
BASIC Source File  |  1999-12-06  |  1KB  |  48 lines

  1. REM Online Timer in Hisoft BASIC by Simon Goodwin
  2. REM For Amiga Format's BANGING THE METAL series
  3. REM
  4. REM This code monitors bit 5 of CIAB port A, pin
  5. REM 8 of the RS-232 port, which IS clear (0) when
  6. REM the modem sends a 'carrier detect' signal.
  7.  
  8. REM $INCLUDE dos.bh
  9. LIBRARY OPEN "dos.library" ' For Delay routine
  10.  
  11. WINDOW 1,"  Hisoft BASIC Online Timer", _
  12.     (200,16)-(240,56),1+2+4+16+256
  13.  
  14. CIAA_PRA&=12570624
  15. ver$="$VER: OnlineTimer 1.2 (23.3.1999)"
  16.  
  17. Timing%=0
  18. LOCATE 2,4
  19. PRINT "Seconds on line: 0";
  20.  
  21. REPEAT check
  22.  
  23.   CD%=(PEEK(CIAA_PRA&) AND 32)
  24.   IF CD%
  25.       Timing%=1 : Start!=TIMER
  26.     ELSE
  27.     IF Timing%
  28.       LOCATE 2,20
  29.       PRINT TIMER-Start!;"     ";
  30.     END IF
  31.   END IF
  32.     
  33.   Delay &30 ' Update periodically
  34.   
  35. END REPEAT check
  36.  
  37. REM This is just a very simple example.
  38. REM Suggested updates: keep a log file?
  39. REM
  40. REM Convert times to hours and minutes?
  41. REM
  42. REM Check the real time with TIME$ and
  43. REM display running call costs according
  44. REM to the date and time of day?
  45. REM
  46. REM Adjust to monitor the CD bit on other
  47. REM serial ports (IOBLIX, GVP, MFC etc)?
  48.